package day_803;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.net.PasswordAuthentication;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class JframeDome {
	public static void main(String[] args) {
		JFrame jframe = new JFrame();
		jframe.setVisible(true);
		jframe.setSize(500, 500);
		jframe.setDefaultCloseOperation(jframe.EXIT_ON_CLOSE);

		JPanel panel = new JPanel();
		jframe.add(panel);
		//panel.setLayout(new FlowLayout());按钮默认居中分布
		panel.setLayout(new BorderLayout());//按钮按方位排列
		panel.setLayout(new GridBagLayout());//按钮按照网格状布局

		JButton nButton = new JButton("北丐");
		JButton sButton = new JButton("南帝");
		JButton eButton = new JButton("东邪");
		JButton wButton = new JButton("西毒");
		JButton zhongButton = new JButton("中神通");

		panel.add(nButton, BorderLayout.NORTH);
		panel.add(sButton, BorderLayout.SOUTH);
		panel.add(eButton, BorderLayout.EAST);
		panel.add(wButton, BorderLayout.WEST);
		panel.add(zhongButton, BorderLayout.CENTER);

	}
}
